// import { UnityEngine } from "csharp";
import {Node } from "cc";
import NodeHelper from "./NodeHelper";
import { Vector3 } from "./Vec";


export class BindNode
{
    set name(val:string)
    {
        NodeHelper.SetNodeName(this,val);
    }

    get name()
    {
        return this.uObj.name;
    }

    get activeSelf()
    {
       return this.uObj.active;
    }

    FindChild(findName:string)
    {
        let obj = NodeHelper.FindChild(this,findName);
        return new BindNode(obj);
    }

    private _uObject:Node;

    public get uObj():Node
    {
        return this._uObject; 
    }



    public constructor(uObj:Node)
    {
        this._uObject = uObj;
    }


    public SetParent(bindNode:BindNode,stayWorldPos:boolean = false)
    {
         
        NodeHelper.SetParent(this,bindNode,stayWorldPos);
 
    }

    public SetPosition(v3:Vector3)
    {
        NodeHelper.SetPosition(this,v3);
    }

    public SetActive(state:boolean)
    {
        NodeHelper.SetActive(this,state);
    }


    public GetComponent(typeCom:string)
    {
        return NodeHelper.GetComponent(this,typeCom);
    }

    

    //尽量不要销毁节点,调试用可以
    public Destory()
    {
        NodeHelper.Destory(this);
    }
   
    
}